package com.situ.gym.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.gym.mapper.CoachMapper;
import com.situ.gym.pojo.Coach;
import com.situ.gym.pojo.Coach;
import com.situ.gym.mapper.CoachMapper;
import com.situ.gym.pojo.query.CoachQuery;
import com.situ.gym.pojo.vo.CoachCount;
import com.situ.gym.service.ICoachService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Guan
 * @since 2025-08-28
 */
@Service
public class CoachServiceImpl extends ServiceImpl<CoachMapper, Coach> implements ICoachService {
    //依赖注入
    @Autowired
    private CoachMapper coachMapper;
    
    //分页查找
    @Override
    public IPage<Coach> list(CoachQuery coachQuery) {
        IPage<Coach> page = new Page<>(coachQuery.getPage(),coachQuery.getLimit());
        return coachMapper.list(page,coachQuery);
    }

    //批量删除
    @Override
    public void deleteAll(Integer[] ids) {
        coachMapper.deleteAll(ids);
    }

    //统计图表的教练的课程数
    @Override
    public List<CoachCount> selectCoachCount() {
        return coachMapper.selectCoachCount();
    }
}
